<template>
<view class="record-item">
  <view class="left">
    <view class="name-status">
      <up-tag :text="recordItem.tagText" :type="recordItem.tagType" size="mini"/>
      <text class="order-name">
        {{ recordItem.recordItemName }}
      </text>
    </view>
    <view class="record-info">
      <view class="record-info-price">
        <text>预约看房:</text>
        <text>
          {{ recordItem.recordHouseName }}
        </text>
      </view>

      <view class="record-info-time">
        <text>预约时间:</text>
        <text>
          {{ recordItem.recordItemTime }}
        </text>
      </view>

      <view class="record-info-refuse" v-if="recordItem.tagText === '未通过'">
        <text>审核未通过原因:</text>
        <text>
          {{ recordItem.auditOpinion || '暂无' }}
        </text>
      </view>
    </view>
  </view>
<view class="right">
  <view v-if="!cancelBtnShowControlDict.includes(recordItem.tagText)" class="btn" @tap="handleCancelBtnClick">
    撤销
  </view>
</view>
</view>
</template>
<script setup>
import {defineProps, defineEmits} from 'vue'
const props = defineProps({
  recordItem: {
    type: Object,
    default:() =>  {
      return {
        tagText: '',
        tagType: 'info',
        recordItemName: '',
        recordItemPrice: '',
        recordItemTime: '',
        auditOpinion: ''
      }
    }
  }
})

const cancelBtnShowControlDict = [
    '已撤销',
    '未通过'
]
const emits = defineEmits(['cancelBtnClick'])
const handleCancelBtnClick = () => {
  emits('cancelBtnClick', props.recordItem)
}
</script>
<style scoped lang=less>
@import "style/record-item";
</style>
